//
//  PurchaseGoodsTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/3.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "PurchaseGoodsTableViewCell.h"

@interface PurchaseGoodsTableViewCell ()
{
    GLGWLabel * goodsNumLabel;
    //
    GLGWLabel * piceLabel;
}
@property (nonatomic,strong) GLGWLabel * goodsNameLabel;
@property (nonatomic,strong) GLGWLabel * weightLabel;
@property (nonatomic,strong) GLGWLabel * specLabel;
@end

@implementation PurchaseGoodsTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        GLGWView * showDowView = [[GLGWView alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(27), kHeightProportion_In_iPhoneTriploid(18), KScreenWidth - kWidthProportion_In_iPhoneTriploid(42), kHeightProportion_In_iPhoneTriploid(87)) inSuperView:self.contentView];
        showDowView.backgroundColor = [UIColor whiteColor];
        [showDowView setViewShadowWidth:3.0 theCornerRadius:3.0];
        //
        self.goodsNameLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:showDowView];
        self.goodsNameLabel.text = @"三级螺纹钢";
        [self.goodsNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(showDowView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(showDowView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(20));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
        //
        self.weightLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:showDowView];
        self.weightLabel.text = @"50吨";
        self.weightLabel.textAlignment = NSTextAlignmentRight;
        [self.weightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(showDowView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(showDowView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(21));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
            make.left.equalTo(self.goodsNameLabel.mas_right).offset(kWidthProportion_In_iPhoneTriploid(5));
        }];
        // 设置优先级
        [self.goodsNameLabel setContentCompressionResistancePriority:(UILayoutPriorityDefaultLow) forAxis:(UILayoutConstraintAxisHorizontal)];
        [self.weightLabel setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh) forAxis:(UILayoutConstraintAxisHorizontal)];
        //
        self.specLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:showDowView];
        self.specLabel.text = @"HRB400E 400*300 河钢";
        [self.specLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.goodsNameLabel);
            make.top.equalTo(self.goodsNameLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(5));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        //
        piceLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:showDowView];
        piceLabel.text = @"最高5000元/吨";
        piceLabel.textAlignment = NSTextAlignmentRight;
        [piceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.weightLabel);
            make.top.equalTo(self.weightLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(6));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
            make.left.equalTo(self.specLabel.mas_right).offset(kWidthProportion_In_iPhoneTriploid(5));
        }];
        //优先级
        [self.specLabel setContentCompressionResistancePriority:(UILayoutPriorityDefaultLow) forAxis:(UILayoutConstraintAxisHorizontal)];
        [piceLabel setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh) forAxis:(UILayoutConstraintAxisHorizontal)];
        /*********/
        //
        GLGWView * numView = [[GLGWView alloc] initWithInSuperView:showDowView];
        numView.backgroundColor = [UIColor whiteColor];
        [numView setViewShadowWidth:4.0 theCornerRadius:kWidthProportion_In_iPhoneTriploid(12.5)];
        [numView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(showDowView.mas_left).offset(-kWidthProportion_In_iPhoneTriploid(12.5));
            make.top.equalTo(showDowView.mas_top).mas_offset(-kWidthProportion_In_iPhoneTriploid(12.5));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(25)));
            make.height.equalTo(@(kWidthProportion_In_iPhoneTriploid(25)));
        }];
        goodsNumLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Yellow inSuperView:numView];
        goodsNumLabel.text = @"1";
        [goodsNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(numView);
        }];
        //
        
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
